Memory Investigation
This lab has a series of investigative tasks related to memory.  Just submit answers to the questions, plus your memory-user.c program.   There are both questions to get you thinking, plus some questions labeled Q<n>, which are the ones you need to submit answers for.
 
1.	The first Linux tool you should check out is the very simple tool free. First, type man free and read its entire manual page; it’s short, don’t worry!
2.	Now, run free, perhaps using some of the arguments that might be useful (e.g., -m, to display memory totals in megabytes, or -h for human scale). 
Q1:  How much memory is in your system? How much is free? Do these numbers match your intuition?  Include a snapshot of your free output.
3.	Next, create a little program that uses a certain amount of memory, called memory-user.c. This program should take one command-line argument: the number of megabytes of memory it will use. When run, it should allocate an array, and constantly stream through the array, touching each entry. The program should do this indefinitely, or, perhaps, for a certain amount of time also specified at the command line.   Make sure that you use malloc to create the array, or large sizes will blow up your program -- because a local variable will be allocated on the stack, and the stack is limited in size.
4.	Now, while running your memory-user program, also (in a different terminal window, but on the same machine) run the free tool. 
Q2: How do the memory usage totals change when your program is running? How about when you kill the memory-user program? Do the numbers match your expectations? Try this for different amounts of memory usage. What happens when you use really large amounts of memory?  Look closely at your free output before, during and after running your memory program with a large value.  By large value, you should be trying values larger than your physical memory on your machine -- 1000 - 2000 MB.
ADD LINUX SEEMS TO SEGV IF TRY MORE THAN 2GB, SO RUN MULTIPLES INSTEAD TO FORCE SWAP USAGE
1.	Let’s try one more tool, known as pmap. Spend some time, and read the pmap manual page in detail.
2.	To use pmap, you have to know the process ID of the process you’re interested in. Thus, first run ps auxw to see a list of all processes; then, pick an interesting one, such as a browser. You can also use your memory-user program in this case (indeed, you can even have that program call getpid()and print out its PID for your convenience).
3.	Now run pmap on some of these processes, using various flags (like -X) to reveal many details about the process. What do you see? How many different entities make up a modern address space, as opposed to our simple conception of code/stack/heap?
4.	Finally, let’s run pmap on your memory-user program, with different amounts of used memory. What do you see here? Does the output from pmap match your expectations?
Q3: Include your pmap output, and identify as many sections as you can, by the starting address.